var e = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../@babel/runtime/regenerator")), t = require("../../@babel/runtime/helpers/asyncToGenerator"), r = getApp(), a = (require("../../utils/api.js"), 
require("../../http/productApi.js"));

Page({
    data: {
        inited: !1,
        systemInfo: r.data.systemInfo
    },
    onLoad: function(e) {},
    onShow: function() {
        this.reloadDetail();
    },
    boxItemOnSelected: function(e) {
        console.log("【选中小盒】", e);
        var t = e.detail.index, r = this.data.dynamicInfo.boxList[t];
        wx.navigateTo({
            url: "/pages/try-open/try-open?productId=" + r.productId + "&boxId=" + r.boxId
        });
    },
    reloadDetail: function() {
        var o = this;
        return t(e.default.mark(function t() {
            var n;
            return e.default.wrap(function(e) {
                for (;;) switch (e.prev = e.next) {
                  case 0:
                    return wx.showLoading({
                        title: "加载中…"
                    }), e.prev = 1, e.next = 4, a.tryProduct();

                  case 4:
                    n = e.sent, r.data.cacheTryProduct = n.data, o.setData({
                        inited: !0,
                        title: n.data.demoProductBrightBox.productTitle,
                        staticInfo: n.data.demoProductBrightBox,
                        dynamicInfo: {
                            boxList: n.data.drawBoxList
                        },
                        cardList: n.data.memberOpenBoxList,
                        tryNum: n.data.surplusNum
                    }), e.next = 12;
                    break;

                  case 9:
                    e.prev = 9, e.t0 = e.catch(1), console.log(e.t0);

                  case 12:
                    return e.prev = 12, wx.hideLoading(), e.finish(12);

                  case 15:
                  case "end":
                    return e.stop();
                }
            }, t, null, [ [ 1, 9, 12, 15 ] ]);
        }))();
    }
});